package org.ioc.com.book6.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.ioc.com.book6.model.BookInfo;

import java.util.List;

@Mapper
public interface BookInfoMapper {
    //插入图书
    @Insert("insert into book_info(book_name,author,count,price,publish,status) " +
            "values(#{bookName},#{author},#{count},#{price},#{publish},#{status})")
    Integer queryInsertBook(BookInfo bookInfo);

    //查询图书--分页查询
    @Select("select * from book_info limit #{offset},#{limit}")
    List<BookInfo> querySelect(Integer offset, Integer limit);

    //查询数据总数
    @Select("select count(*) from book_info")
    Integer count();

    //查询一条数据
    @Select("select * from book_info where id=#{id}")
    BookInfo querySelectOne(Integer id);

    Integer queryUpdate(BookInfo bookInfo);

    Integer queryDelete(Integer id);

    Integer queryBatchBook(List<Integer> id);
}
